import React, {
    useCallback,
    useEffect,
    useLayoutEffect,
    useMemo,
    useState
} from "react";
import {connect, useDispatch} from "react-redux";
import intl from "react-intl-universal";
import moment from "moment";
import axiosMethod from "../../../../../../common/axios/index";
import Empty from "../../../../../../common/component/empty";
import $ from "jquery";
import {LgTabs, LgCheckbox} from "lancoo-web-ui";
import { Radio, DatePicker, TimePicker, Collapse, Checkbox, Select, Calendar, Dropdown, Menu, Tooltip, Popover, message, notification } from "antd";
import { getRangeDate, getDateType, getDateWeek, constructionDate, getUrlQueryVariable, getTimeDiff } from "../../../../../../common/util/index";
import "./index.scss";
import Scrollbars from "react-custom-scrollbars";
import MyModal from "../../../../../../common/component/modal";
import Search from "../../../../../../common/component/search";
import TableList from "../../../../../../common/component/fileList";
import QRCodeDialog from "../../../../modal/QRCodeDialog";

const columns = [
    {
        key: "index",
        width: "5%",
        textColor: "#999"
    },
    {
        key: "updateName",
        width: "35%",
        textAlign: "left",
        padding: "0 20px 0 42px",
        name: "姓名"
    },
    {
        key: "userId",
        width: "20%",
        textAlign: "left",
        padding: "0 0 0 27px",
        textColor: "#999",
        name: "用户名"
    },
    {
        key: "updateStatus",
        width: "20%",
        name: "状态"
    },
    {
        key: "operate_group",
        width: "20%",
        textAlign: "left",
        padding: "0 0 0 10px",
        name: "操作"
    }
]

function MyScheduleWeek(props){
    const {
        skinInfo,
        userInfo,
        deleteSchedule,
        editSchedule,
        goCourse,
        goExternal,
        changeCourse,
        classList,
        identityList,
    } = props;
    const dispatch = useDispatch();
    const [loadVisible, setLoadVisible] = useState(false);
    const [weekDateVisible, setWeekDateVisible] = useState(false);
    const [weekInfo, setWeekInfo] = useState({});
    const [dayList, setDayList] = useState([]);
    const [currentDay, setCurrentDay] = useState("");
    const [scheduleList, setScheduleList] = useState([]);
    const [monthScheduleList, setMonthScheduleList] = useState([]);
    const [detailTabData, setDetailTabData] = useState([]);
    const scheduleObject = useMemo(()=>{
        let obj = {};
        monthScheduleList.forEach((item)=>{
            obj[item.scheduleDate] = item.scheduleList || [];
        })
        return obj;
    }, [monthScheduleList]);

    const [scheduleInfo, setScheduleInfo] = useState({});
    const [scheduleJoinInfo, setScheduleJoinInfo] = useState({});
    const [scheduleVisible, setScheduleVisible] = useState(false);

    const [meetModalVisible, setMeetModalVisible] = useState(false);
    const [meetModalInfo, setMeetModalInfo] = useState({});
    const [keyword, setKeyword] = useState("");
    const [allMeetUserList, setAllMeetUserList] = useState([]);
    const [meetUserList, setMeetUserList] = useState([]);
    const [qrcodeVisible, setQrcodeVisible] = useState(false);
    const [qrcodeInfo, setQrcodeInfo] = useState({});

    const getDateWeekInfo = useCallback((date)=>{   //获取指定日期的周次信息
        axiosMethod({
            type: "get",
            url: "/api/common/school/term/date/week/info",
            body: {
                eduId: userInfo.eduId,
                userId: userInfo.userId,
                userType: userInfo.userType,
                date: moment(date).format("YYYY-MM-DD")
            },
            callback: function(res){
                if(!res){
                    setWeekInfo({});
                    return;
                }
                typeof date === "string" && setCurrentDay(date);
                setWeekInfo(res);
            }
        });
    }, [userInfo]);

    const getMonthScheduleList = useCallback((date)=>{
        date = date? date: moment(currentDay);
        let startTime = date.startOf("month").format("YYYY-MM-DD");
        let endTime = date.endOf("month").format("YYYY-MM-DD");
        let dateRange = getRangeDate(startTime, endTime);
        axiosMethod({ 
            type: "get",
            // url: "/api/homepage/schedule/info/new/personal/list",
            url: "api/schedule/list/person",
            body: {
                eduId: userInfo.eduId,
                userId: userInfo.userId,
                userType: userInfo.userType,
                startTime,
                endTime
            },
            callback: function(res){
                setLoadVisible(false);
                if(!res){
                    setMonthScheduleList([]);
                    return;
                }
                let arr = [];
                dateRange.forEach((item)=>{
                    let obj = {
                        scheduleDate: item,
                        scheduleList: [],
                        doingCount: 0
                    };
                    res.forEach((child)=>{
                        if(child.scheduleDate === item){
                            obj.scheduleList.push(child);
                            if(moment(`${child.scheduleDate} ${child.endTime}`) >= moment(constructionDate())){
                                obj.doingCount++;
                            }
                        }
                    })
                    arr.push(obj);
                })
                setMonthScheduleList(arr);
            }
        });
    }, [userInfo, currentDay]);

    const getDayList = useCallback(()=>{   //获取时间段内的日程列表
        let dateRange = getRangeDate(weekInfo.startDate, weekInfo.endDate);
        axiosMethod({ 
            type: "get",
            // url: "/api/homepage/schedule/info/new/personal/list",
            url: "api/schedule/list/person",
            body: {
                eduId: userInfo.eduId,
                userId: userInfo.userId,
                userType: userInfo.userType,
                startTime: weekInfo.startDate,
                endTime: weekInfo.endDate,
            },
            callback: function(res){
                setLoadVisible(false);
                if(!res){
                    setDayList([]);
                    return;
                }
                let arr = [];
                dateRange.forEach((item)=>{
                    let obj = {
                        scheduleDate: item,
                        scheduleList: [],
                        doingCount: 0
                    };
                    res.forEach((child)=>{
                        if(child.scheduleDate === item){
                            obj.scheduleList.push(child);
                            if(moment(`${child.scheduleDate} ${child.endTime}`) >= moment(constructionDate())){
                                obj.doingCount++;
                            }
                        }
                    })
                    arr.push(obj);
                })
                setDayList(arr);
                //没有当前日期或者切换其他周次时才赋值为第一个
                if(!currentDay || !dateRange.includes(currentDay)){
                    if(dateRange.includes(constructionDate("", 3))){
                        setCurrentDay(constructionDate("", 3));
                    } else {
                        setCurrentDay(arr[0]?.scheduleDate);
                    }
                }
            }
        });
    }, [weekInfo, userInfo, currentDay]);

    const onDatePanelChange = (value) => {
        getMonthScheduleList(value);
    }

    const onDateChange = useCallback((value)=>{  //选择查看某一天的日程信息
        getDateWeekInfo(value.format("YYYY-MM-DD"));
        setWeekDateVisible(false);
    }, [getDateWeekInfo]);

    const renderDateTableCell = useCallback((currentDate, today)=>{  //渲染日程弹窗单元格
        let dateFormat = currentDate.format("YYYY-MM-DD");
        let date = currentDate.date(), scheduleList = scheduleObject[dateFormat]||[];
        let sign = scheduleList.length > 0? true: false;
        if(sign){
            return (
                <Popover
                overlayClassName="date_table_cell_popover"
                getPopupContainer={(trigger)=>document.body}
                content={(
                    <div className="date_table_cell_popover_content">
                        <h3 className="date_table_cell_info">
                            <span>{date}</span>
                            {getDateWeek(dateFormat)}
                        </h3>
                        <Scrollbars autoHeight autoHeightMax={150}>
                        {
                            scheduleList.map((item, index)=>(
                                <p className="date_table_cell_schedule" key={index} title={item.scheduleTitle||item.scheduleContent}>
                                    {item.scheduleTitle||item.scheduleContent}
                                </p>
                            ))
                        }
                        </Scrollbars>
                    </div>
                )}>
                    <div className="ant-picker-cell-inner">
                        {date}
                        <i className="date_table_cell_exsit"></i>
                    </div>
                </Popover>
            )
        }
        return (
            <div className="ant-picker-cell-inner">
                {date}
            </div>
        );
    }, [scheduleObject]);

    const getScheduleList = useCallback((date)=>{   //获取某一日期下的日程列表
        let arr = [];
        let list = JSON.parse(JSON.stringify(dayList));
        list.forEach((item)=>{
            if(item.scheduleDate === date){
                arr = item.scheduleList;
            }
        })
        arr.forEach(item=>item.show = false);
        setCurrentDay(date);
        setScheduleList(arr);
    }, [dayList]);

    const dayClick = useCallback((value, index, e)=>{
        setCurrentDay(value);
        // let width = $(e.target).width();
        // $('.active_box').css('left', index*width + 61);
    }, []);

    const getScheduleInfo = useCallback((data, visible, index)=>{  //获取某一日程详情
        if(!visible){
            // setScheduleInfo({});
            // setScheduleJoinInfo({});
            return;
        }
        // scheduleList.forEach(item=>item.show = false);
        // if(index>=-1){
        //     if(index===-1){
        //         scheduleList.forEach((item)=>{
        //             if(item.scheduleId === data.scheduleId){
        //                 item.show = true;
        //             }
        //         })
        //     } else {
        //         scheduleList[index].show = true;
        //     }
        // }
        
        if(data.beCourse === "1"){
            setScheduleInfo(data);
        } else {
            axiosMethod({ 
                type: "get",
                url: "api/schedule/info/detail",
                body: {
                    eduId: userInfo.eduId,
                    userId: userInfo.userId,
                    userType: userInfo.userType,
                    scheduleId: data.scheduleId
                },
                callback: function(res){
                    setScheduleVisible(false);
                    console.log(res, 'res')
                    if(!res){
                        setScheduleInfo({});
                        return;
                    }
                    let meetSign1 = [], meetSign0 = [];
                    res.scheduleMemberSignInVoList &&
                    res.scheduleMemberSignInVoList.forEach((item)=>{
                        if(item.signInStatus === "1"){
                            meetSign1.push(item);
                        } else if(item.signInStatus === "0"){
                            meetSign0.push(item);
                        }
                    })
                    res.meetSignInfo = {
                        "meetSign1": meetSign1.length,
                        "meetSign0": meetSign0.length
                    }
                    let rejuct = [], access = [], read = [], noResponse = [];
                    let all = res.scheduleMemberVoList?.length? res.scheduleMemberVoList: res.taskMemberVoList?.length? res.taskMemberVoList: [];
                    all.forEach((item)=>{
                        if(item.attendFlag === "0" || item.progress === "0"){
                            noResponse.push(item);
                        }
                        if(item.attendFlag === "1"){
                            read.push(item);
                        }
                        if(item.attendFlag === "2" || item.progress === "1"){
                            access.push(item);
                        }
                        if(item.attendFlag === "3" || item.progress === "3"){
                            rejuct.push(item);
                        }
                    })
                    res.joinUserInfo = {
                        "all": all.length,
                        "access": access.length,
                        "read": read.length,
                        "reject": rejuct.length,
                        "noResponse": noResponse.length
                    }
                    if(res.taskMemberVoList?.length){
                        setDetailTabData([
                            {
                                key: '0',
                                label: <span className="tab_title" data-sign="schedule">全部<i>[{all.length}]</i></span>,
                                content: (
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            all.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        {
                                                            item.attendFlag === "0"?
                                                            "":
                                                            item.attendFlag === "1"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                            </svg>:
                                                             item.attendFlag === "2"?
                                                             <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                             <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                 <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#16bb16" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                 <rect width="14" height="14" rx="3" stroke="none"/>
                                                                 <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                 </g>
                                                                 <path id="圆角矩形_5" data-name="圆角矩形 5" d="M1015.708,696.806,1013.151,694a.71.71,0,0,1,0-.936.567.567,0,0,1,.853,0l2.131,2.341,3.836-4.214a.567.567,0,0,1,.853,0,.711.711,0,0,1,0,.937l-4.263,4.681a.564.564,0,0,1-.852,0Z" fill="#fff"/>
                                                             </g>
                                                             </svg>:
                                                            item.attendFlag === "3"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="red" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <path id="联合_19" data-name="联合 19" d="M-3980.506-3051.258l-2.494-2.495-2.494,2.495a.882.882,0,0,1-1.247,0,.88.88,0,0,1,0-1.246l2.494-2.5-2.494-2.494a.882.882,0,0,1,0-1.248.882.882,0,0,1,1.247,0l2.495,2.495,2.494-2.495a.883.883,0,0,1,1.248,0,.881.881,0,0,1,0,1.248l-2.494,2.494,2.494,2.494a.881.881,0,0,1,0,1.248.881.881,0,0,1-.624.258A.883.883,0,0,1-3980.506-3051.258Z" transform="translate(5000 3749)" fill="#fff" stroke="rgba(0,0,0,0)" stroke-miterlimit="10" stroke-width="1"/>
                                                            </g>
                                                            </svg>:
                                                            ""
                                                        }
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                    
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>
                                ),
                            },{
                                key: '1',
                                label: <span className="tab_title" data-sign="schedule">已接受<i>[{access.length}]</i></span>,
                                content: (
                                    access.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            access.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                       backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="勾" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#32b432"/>
                                                            <path id="联合_7" data-name="联合 7" d="M-2907.076,8.5h-4.151a.773.773,0,0,1-.772-.773.773.773,0,0,1,.772-.772h3.475V.708a.708.708,0,0,1,.708-.708.708.708,0,0,1,.708.708V7.686q0,.018,0,.037t0,.037v.028a.708.708,0,0,1-.708.708Z" transform="translate(2804.096 2578.094) rotate(45)" fill="#fff"/>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已接受人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '2',
                                label: <span className="tab_title" data-sign="schedule">已拒绝<i>[{rejuct.length}]</i></span>,
                                content: (
                                    rejuct.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            rejuct.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="叉" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#ec5260"/>
                                                            <g id="组_6447" data-name="组 6447">
                                                            <path id="路径_4303" data-name="路径 4303" d="M741.375,522.75l4.75,4.625" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            <path id="路径_4304" data-name="路径 4304" d="M741.375,522.75l4.75,4.625" transform="translate(1268.813 -218.688) rotate(90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            </g>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已拒绝人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '3',
                                label: <span className="tab_title" data-sign="schedule">未响应<i>[{noResponse.length}]</i></span>,
                                content: (
                                    noResponse.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            noResponse.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无未响应人员~</p>
                                    </ul>
                                ),
                            }
                        ])
                    } else {
                        setDetailTabData([
                            {
                                key: '0',
                                label: <span className="tab_title" data-sign="schedule">全部<i>[{all.length}]</i></span>,
                                content: (
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            all.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        {
                                                            item.attendFlag === "0"?
                                                            "":
                                                            item.attendFlag === "1"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                            </svg>:
                                                             item.attendFlag === "2"?
                                                             <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                             <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                 <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#16bb16" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                 <rect width="14" height="14" rx="3" stroke="none"/>
                                                                 <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                 </g>
                                                                 <path id="圆角矩形_5" data-name="圆角矩形 5" d="M1015.708,696.806,1013.151,694a.71.71,0,0,1,0-.936.567.567,0,0,1,.853,0l2.131,2.341,3.836-4.214a.567.567,0,0,1,.853,0,.711.711,0,0,1,0,.937l-4.263,4.681a.564.564,0,0,1-.852,0Z" fill="#fff"/>
                                                             </g>
                                                             </svg>:
                                                            item.attendFlag === "3"?
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="red" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <path id="联合_19" data-name="联合 19" d="M-3980.506-3051.258l-2.494-2.495-2.494,2.495a.882.882,0,0,1-1.247,0,.88.88,0,0,1,0-1.246l2.494-2.5-2.494-2.494a.882.882,0,0,1,0-1.248.882.882,0,0,1,1.247,0l2.495,2.495,2.494-2.495a.883.883,0,0,1,1.248,0,.881.881,0,0,1,0,1.248l-2.494,2.494,2.494,2.494a.881.881,0,0,1,0,1.248.881.881,0,0,1-.624.258A.883.883,0,0,1-3980.506-3051.258Z" transform="translate(5000 3749)" fill="#fff" stroke="rgba(0,0,0,0)" stroke-miterlimit="10" stroke-width="1"/>
                                                            </g>
                                                            </svg>:
                                                            ""
                                                        }
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                    
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>
                                ),
                            },{
                                key: '1',
                                label: <span className="tab_title" data-sign="schedule">已接受<i>[{access.length}]</i></span>,
                                content: (
                                    access.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            access.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                       backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="勾" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#32b432"/>
                                                            <path id="联合_7" data-name="联合 7" d="M-2907.076,8.5h-4.151a.773.773,0,0,1-.772-.773.773.773,0,0,1,.772-.772h3.475V.708a.708.708,0,0,1,.708-.708.708.708,0,0,1,.708.708V7.686q0,.018,0,.037t0,.037v.028a.708.708,0,0,1-.708.708Z" transform="translate(2804.096 2578.094) rotate(45)" fill="#fff"/>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已接受人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '2',
                                label: <span className="tab_title" data-sign="schedule">已拒绝<i>[{rejuct.length}]</i></span>,
                                content: (
                                    rejuct.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            rejuct.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                                        <g id="叉" transform="translate(-738 -519)">
                                                            <rect id="矩形_45" data-name="矩形 45" width="12" height="12" rx="2" transform="translate(738 519)" fill="#ec5260"/>
                                                            <g id="组_6447" data-name="组 6447">
                                                            <path id="路径_4303" data-name="路径 4303" d="M741.375,522.75l4.75,4.625" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            <path id="路径_4304" data-name="路径 4304" d="M741.375,522.75l4.75,4.625" transform="translate(1268.813 -218.688) rotate(90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="1.5"/>
                                                            </g>
                                                        </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无已拒绝人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '3',
                                label: <span className="tab_title" data-sign="schedule">待定<i>[{read.length}]</i></span>,
                                content: (
                                    read.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            read.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
                                                            <g id="标签-已完成" transform="translate(-1008 -685)">
                                                                <g id="圆角矩形_4" data-name="圆角矩形 4" transform="translate(1010 687)" fill="#06f" stroke="#fff" stroke-linejoin="round" stroke-width="2">
                                                                <rect width="14" height="14" rx="3" stroke="none"/>
                                                                <rect x="-1" y="-1" width="16" height="16" rx="4" fill="none"/>
                                                                </g>
                                                                <circle id="椭圆_507" data-name="椭圆 507" cx="1" cy="1" r="1" transform="translate(1016 693)" fill="#fff"/>
                                                                <rect id="矩形_7752" data-name="矩形 7752" width="1" height="5" rx="0.5" transform="translate(1016 690)" fill="#fff"/>
                                                                <rect id="矩形_7753" data-name="矩形 7753" width="1" height="5" rx="0.5" transform="translate(1021 694) rotate(90)" fill="#fff"/>
                                                            </g>
                                                        </svg>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无待定人员~</p>
                                    </ul>
                                ),
                            },{
                                key: '4',
                                label: <span className="tab_title" data-sign="schedule">未读<i>[{noResponse.length}]</i></span>,
                                content: (
                                    noResponse.length > 0?
                                    <Scrollbars autoHeight autoHeightMax={200}>
                                    <ul className="member_list" data-sign="schedule">
                                        {
                                            noResponse.map((item, index)=>(
                                                <li key={index} data-sign="schedule">
                                                    <i className="member_avartar" style={{
                                                        backgroundImage: `url('${item.avatarPath||item.photoPath}')`
                                                    }}>
                                                    </i>
                                                    <p className="member_name" title={item.userName}>{item.userName}</p>
                                                </li>
                                            ))
                                        }
                                    </ul>
                                    </Scrollbars>:
                                    <ul className="member_list" data-sign="schedule">
                                        <p>暂无未读人员~</p>
                                    </ul>
                                ),
                            }
                        ])
                    }
                    setScheduleInfo(res);
                }
            });
        }
        
    }, [userInfo]);

    const closeTooltip = useCallback(()=>{
        scheduleList.forEach(item=>item.show = false);
        setScheduleInfo({});
        setScheduleJoinInfo({});
    }, [scheduleList]);

    const modalChange = useCallback((value, data, e, e2)=>{   //控制日程弹窗显隐
        e2 && e2.stopPropagation();
        e && e.stopPropagation();
        if(!value){
            dispatch({
                type: "SET_ADDSCHEDULEINFO",
                data: {
                    visible: value,
                    scheduleInfo: {
                        remindFlag: 1,
                        remindTime: "30",
                        repeatTime: 0  
                    }
                }
            })
        } else {
            let clickPosition = {};
            if(e){
                let screenHeight = $(window).height();
                let left = $(e.target).offset().left;
                let top = $(e.target).offset().top;
                if(top+302>screenHeight){
                    top = screenHeight - 332;
                }
                clickPosition = {
                    left: left + 76,
                    top: top + 10
                }
                dispatch({
                    type: "SET_ADDSCHEDULEINFO",
                    data: {
                        visible: value,
                        clickPosition,
                        scheduleInfo: {
                            remindFlag: 1,
                            remindTime: "30",
                            repeatTime: 0,
                            scheduleDate: data.scheduleDate,
                            scheduleEndDate: data.scheduleEndDate,
                            startTime: moment(data.scheduleDate + " " + data.startTime).add("1", "h").set('minutes', 0).unix() > moment().unix()? moment(data.scheduleDate + " " + data.startTime).add("1", "h").set('minutes', 0).format("HH:mm"): moment().add("1", "h").set('minutes', 0).format("HH:mm"),
                            endTime: moment(data.scheduleDate + " " + data.startTime).add("2", "h").set('minutes', 0).unix() > moment().unix()? moment(data.scheduleDate + " " + data.startTime).add("2", "h").set('minutes', 0).format("HH:mm"): moment().add("2", "h").set('minutes', 0).format("HH:mm"),
                        }
                    }
                })
            } else {
                if(data && data.scheduleDate){
                    dispatch({
                        type: "SET_ADDSCHEDULEINFO",
                        data: {
                            visible: value,
                            clickPosition,
                            scheduleInfo: {
                                remindFlag: 1,
                                remindTime: "30",
                                repeatTime: 0,
                                scheduleDate: data.scheduleDate,
                                scheduleEndDate: data.scheduleEndDate,
                                startTime: moment(data.scheduleDate + " " + data.startTime).add("1", "h").set('minutes', 0).unix() > moment().unix()? moment(data.scheduleDate + " " + data.startTime).add("1", "h").set('minutes', 0).format("HH:mm"): moment().add("1", "h").set('minutes', 0).format("HH:mm"),
                                endTime: moment(data.scheduleDate + " " + data.startTime).add("2", "h").set('minutes', 0).unix() > moment().unix()? moment(data.scheduleDate + " " + data.startTime).add("2", "h").set('minutes', 0).format("HH:mm"): moment().add("2", "h").set('minutes', 0).format("HH:mm"),
                            }
                        }
                    })
                } else {
                    dispatch({
                        type: "SET_ADDSCHEDULEINFO",
                        data: {
                            visible: value,
                            clickPosition
                        }
                    })
                }
                
            }
        }
    }, []);

    const showMeeInfoModal = (data) => {
        setMeetModalInfo(data);
        setMeetModalVisible(true);
    }

    const searchMeetUser = (value) => {
        if(value){
            let arr = meetUserList.filter(item=>item.userName.indexOf(value)>-1);
            setMeetUserList(arr);
        } else {
            setMeetUserList(allMeetUserList);
        }
        setKeyword(value);
    }

    const ouputMeetJoinInfo = useCallback((data) => {
        let xhr = new XMLHttpRequest();
        xhr.open("get", window._BasicProxy+`/api/schedule/export/signInMemberExportWord?scheduleId=${data.scheduleId}&eduId=${userInfo.eduId}`, true);
        xhr.setRequestHeader("Authorization", sessionStorage.getItem("token"))
        xhr.responseType = 'blob';
        xhr.onreadystatechange = function(){
            if(xhr.status === 200 && xhr.readyState === 4){
                let blob = new Blob([xhr.response], {type:"application/msword"});
                let url = URL.createObjectURL(blob);
                let a = document.createElement("a");
                a.href = url;
                a.download = data.scheduleTitle+"-会议详情-" + moment().format("YYYY-MM-DD");
                a.click();
                URL.revokeObjectURL(url);
            }
        }
        xhr.send();
        // window.open(window._BasicProxy+`/api/schedule/export/signInMemberExportWord?scheduleId=${data.scheduleId}&schoolId=${userInfo.schoolId}&lg_tk=${sessionStorage.getItem('token')}`);
    }, [userInfo]);

    const meetSignCheck = useCallback((data) => {
        axiosMethod({ 
            type: "post",
            url: "api/schedule/member/updateSignInStatus",
            body: {
                eduId: userInfo.eduId,
                userId: userInfo.userId,
                signInStatus: 1,
                scheduleId: data.scheduleId
            },
            callback: function(res, info){
                if(info.code === "200"){
                    message.success("设置成功");
                    getScheduleInfo(data);
                }
            }
        });
    }, [userInfo, getScheduleInfo]);

    const qrcodeModalChange = (value) => {
        setQrcodeVisible(value);
    }

    const getQRcodeInfo = (data) => {
        setQrcodeInfo(data);
        setQrcodeVisible(true);
    }

    useEffect(()=>{
        if(scheduleInfo.scheduleId){
            let arr = scheduleInfo.scheduleMemberSignInVoList||[];
            let result = arr.map((item, index)=>{
                let obj = {...item};
                obj.updateName = (
                    <div className="table-update-name" key={index}>
                        <i className="user-header" style={{
                            backgroundImage: `url('${item.photoPath}')`
                        }}></i>
                        <span className="user-name" title={item.userName}>
                            {item.userName}
                        </span>
                    </div>
                )
                obj.updateStatus = (
                    <div className="table-update-status" style={{
                        color: item.signInStatus === "1"? "#009900": "#ff6600"
                    }}>{item.signInStatus === "1"? "已签到": "未签到"}</div>
                )
                if(item.signInStatus === "1"){
                    obj.operate_group = (<div></div>);
                } else {
                    obj.operate_group = (
                        <div className="btn-group" key={index}>
                            <span className="blue-btn" onClick={()=>meetSignCheck(item)}>设为已签到</span>
                        </div>
                    )
                }
                
                return obj;
            })
            setMeetUserList(result);
            setAllMeetUserList(result);
        }
    }, [scheduleInfo, meetSignCheck]);


    useLayoutEffect(()=>{
        window.addEventListener("click", function(e){
            let className = $(e.target).attr("class");
            let parentClassName = $(e.target).parent().attr("class");
            if((className && className === "date_btn") ||
            (parentClassName && parentClassName.indexOf("ant-picker") !== -1)){
                
            } else {
                setWeekDateVisible(false);
            }
        })
    }, []);

    useLayoutEffect(()=>{
        getDateWeekInfo(new Date());
    }, [getDateWeekInfo]);

    useEffect(()=>{
        if(!weekInfo.startDate){
            return;
        }
        getDayList();
    }, [weekInfo, getDayList]);

    useEffect(()=>{
        if(!currentDay){
            return;
        }
        getScheduleList(currentDay);
    }, [currentDay, dayList, getScheduleList]);

    useEffect(()=>{
        if(!dayList.length){
            return;
        }
        let target = 0;
        dayList.forEach((item, index)=>{
            if(item.scheduleDate === currentDay){
                target = index;
            }
        })
        let width = $('.week_one').width();
        $('.active_box').css({
            'right': (dayList.length - 1 - target)*width + 60,
            'display': "block"
        });
        window.addEventListener("resize", function(){
            let target = 0;
            dayList.forEach((item, index)=>{
                if(item.scheduleDate === currentDay){
                    target = index;
                }
            })
            let width = $('.week_one').width();
            $('.active_box').css({
                'right': (dayList.length - 1 - target)*width + 60,
                'display': "block"
            });
        })
    }, [currentDay, dayList]);

    useLayoutEffect(()=>{
        //获取当前月的日程情况，用于显示日期弹窗上的小红点
        getMonthScheduleList(moment());
    }, []);
    
    useLayoutEffect(()=>{
        window._getDayList = getDayList;
        window._getScheduleInfo = getScheduleInfo;
        window._getScheduleMonthList = getMonthScheduleList;
        
    }, [getDayList, getScheduleInfo, getMonthScheduleList])
    return (
        <div className="type-week-schedule">
        <div className="schedule_head">
            <div className="head_week">{weekInfo.weekNo?`第${weekInfo.weekNo}周`:""}</div>
            {
                dayList.length?
                <div className="active_box">
                    <svg width="90" height="63.092" viewBox="0 0 90 63.092">
                    {
                        skinInfo.userSkin === "4"?
                        <defs>
                            <linearGradient id="linear-gradient" x1="1" y1="0.5" x2="0" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#036638"/>
                            <stop offset="1" stop-color="#036638"/>
                            </linearGradient>
                            <linearGradient id="linear-gradient-2" x1="0" x2="1"/>
                            <linearGradient id="linear-gradient-3" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#036638"/>
                            <stop offset="1" stop-color="#036638"/>
                            </linearGradient>
                            <clipPath id="clip-path">
                            <rect id="选中" width="50" height="36" rx="5" transform="translate(137 78)" fill="url(#linear-gradient)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-4" x1="0.398" y1="0.441" x2="0.154" y2="0.066" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#fff" stop-opacity="0"/>
                            <stop offset="1" stop-color="#fff" stop-opacity="0.122"/>
                            </linearGradient>
                            <clipPath id="clip-path-2">
                            <rect id="选中-2" data-name="选中" width="50" height="36" rx="5" fill="url(#linear-gradient-2)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-5" x1="0.602" y1="0.559" x2="0.846" y2="0.934"/>
                        </defs>:
                            skinInfo.userSkin === "5"?
                        <defs>
                            <linearGradient id="linear-gradient" x1="1" y1="0.5" x2="0" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#4c40ab"/>
                            <stop offset="1" stop-color="#4c40ab"/>
                            </linearGradient>
                            <linearGradient id="linear-gradient-2" x1="0" x2="1"/>
                            <linearGradient id="linear-gradient-3" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#4c40ab"/>
                            <stop offset="1" stop-color="#4c40ab"/>
                            </linearGradient>
                            <clipPath id="clip-path">
                            <rect id="选中" width="50" height="36" rx="5" transform="translate(137 78)" fill="url(#linear-gradient)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-4" x1="0.398" y1="0.441" x2="0.154" y2="0.066" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#fff" stop-opacity="0"/>
                            <stop offset="1" stop-color="#fff" stop-opacity="0.122"/>
                            </linearGradient>
                            <clipPath id="clip-path-2">
                            <rect id="选中-2" data-name="选中" width="50" height="36" rx="5" fill="url(#linear-gradient-2)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-5" x1="0.602" y1="0.559" x2="0.846" y2="0.934"/>
                        </defs>:
                            skinInfo.userSkin === "6"?
                        <defs>
                            <linearGradient id="linear-gradient" x1="1" y1="0.5" x2="0" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#a60808"/>
                            <stop offset="1" stop-color="#a60808"/>
                            </linearGradient>
                            <linearGradient id="linear-gradient-2" x1="0" x2="1"/>
                            <linearGradient id="linear-gradient-3" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#a60808"/>
                            <stop offset="1" stop-color="#a60808"/>
                            </linearGradient>
                            <clipPath id="clip-path">
                            <rect id="选中" width="50" height="36" rx="5" transform="translate(137 78)" fill="url(#linear-gradient)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-4" x1="0.398" y1="0.441" x2="0.154" y2="0.066" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#fff" stop-opacity="0"/>
                            <stop offset="1" stop-color="#fff" stop-opacity="0.122"/>
                            </linearGradient>
                            <clipPath id="clip-path-2">
                            <rect id="选中-2" data-name="选中" width="50" height="36" rx="5" fill="url(#linear-gradient-2)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-5" x1="0.602" y1="0.559" x2="0.846" y2="0.934"/>
                        </defs>:
                        <defs>
                            <linearGradient id="linear-gradient" x1="1" y1="0.5" x2="0" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#219fff"/>
                            <stop offset="1" stop-color="#0290fd"/>
                            </linearGradient>
                            <linearGradient id="linear-gradient-2" x1="0" x2="1"/>
                            <linearGradient id="linear-gradient-3" y1="0.5" x2="1" y2="0.5" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#1c84f8"/>
                            <stop offset="1" stop-color="#238bff"/>
                            </linearGradient>
                            <clipPath id="clip-path">
                            <rect id="选中" width="50" height="36" rx="5" transform="translate(137 78)" fill="url(#linear-gradient)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-4" x1="0.398" y1="0.441" x2="0.154" y2="0.066" gradientUnits="objectBoundingBox">
                            <stop offset="0" stop-color="#fff" stop-opacity="0"/>
                            <stop offset="1" stop-color="#fff" stop-opacity="0.122"/>
                            </linearGradient>
                            <clipPath id="clip-path-2">
                            <rect id="选中-2" data-name="选中" width="50" height="36" rx="5" fill="url(#linear-gradient-2)"/>
                            </clipPath>
                            <linearGradient id="linear-gradient-5" x1="0.602" y1="0.559" x2="0.846" y2="0.934"/>
                        </defs>
                    }
                    
                    <g id="组_5928" data-name="组 5928" transform="translate(-416 -50)">
                        <path id="选中-3" data-name="选中" d="M5,0H85a5,5,0,0,1,5,5V55a5,5,0,0,1-5,5H47.879c-1.363,0-2.649,3.092-4.289,3.092-1.42,0-3.2-3.092-4.9-3.092H5a5,5,0,0,1-5-5V5A5,5,0,0,1,5,0Z" transform="translate(416 50)" fill="url(#linear-gradient-3)"/>
                        <g id="蒙版组_4" data-name="蒙版组 4" transform="translate(319 -4)" opacity="0.81" clip-path="url(#clip-path)">
                        <circle id="椭圆_9" data-name="椭圆 9" cx="29.5" cy="29.5" r="29.5" transform="translate(144 84)" fill="url(#linear-gradient-4)"/>
                        </g>
                        <g id="蒙版组_22" data-name="蒙版组 22" transform="translate(416 50)" opacity="0.5" clip-path="url(#clip-path-2)">
                        <circle id="椭圆_360" data-name="椭圆 360" cx="29.5" cy="29.5" r="29.5" transform="translate(-16 -29)" fill="url(#linear-gradient-5)"/>
                        </g>
                    </g>
                    </svg>
                </div>:
                ""
            }
            {
                dayList.map((item, index)=>(
                    <div 
                    className={`week_one`} 
                    onClick={(e)=>dayClick(item.scheduleDate, index, e)}
                    style={{
                        color: moment(item.scheduleDate) < moment(constructionDate("", 3))? "#999": ""
                    }}
                    key={index}>
                        <div className={`text_container ${item.scheduleDate === currentDay? "date_active": item.scheduleDate === constructionDate("", 3)? "blue": ""}`}>
                        {
                            item.scheduleDate === constructionDate("", 3)?
                            "今天":
                            getDateWeek(item.scheduleDate)
                        }
                        {
                            item.doingCount > 0?
                            <span className="redlogo">{
                                item.doingCount
                            }</span>:
                            ""
                        }
                        {
                            item.scheduleDate === currentDay?
                            <p className="week_date">{item.scheduleDate}</p>:
                            ""
                        }
                        </div>
                    </div>
                ))
            }
            <div className="date_container">
                <i className="date_btn" onClick={()=>setWeekDateVisible(!weekDateVisible)}></i>
                <DatePicker 
                open={weekDateVisible}
                // disabledDate={disabledWeekDate}
                className="weekDate_datepicker"
                onChange={onDateChange}
                onPanelChange={onDatePanelChange}
                dateRender={renderDateTableCell}
                getPopupContainer={(trigger)=>trigger.parentElement} />
            </div>
        </div>
        <Scrollbars autoHeight autoHeightMax={527} renderTrackHorizontal={(props)=><div style={{display: "none"}}></div>}>
        <div className="schedule_list">
            {
                scheduleList.length > 0?
                scheduleList.map((item, index)=>{
                    return (
                    <>
                    <Popover
                    overlayClassName="schedule_popover"
                    trigger={"click"}
                    // open={item.show}
                    zIndex={999}
                    onOpenChange={(value)=>getScheduleInfo(item, value, index)}
                    content={(
                        <div className="schedule_detail" data-sign="schedule">
                            <div className="btn_group" data-sign="schedule">
                                {
                                    item.scheduleTitle && item.scheduleTitle.indexOf("会议")>-1?
                                    <>
                                    <span className="blue-option-btn" onClick={()=>getQRcodeInfo(item)}>签到二维码</span>
                                    <span className="detail-option-slice"></span>
                                    </>
                                    :
                                    ""
                                }
                                {
                                    moment(item.scheduleDate+" "+item.endTime) < moment(constructionDate(""))?
                                    item.beCourse === "1"?
                                    "":
                                    <svg onClick={()=>deleteSchedule(item)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                    <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                                    </svg>:
                                    item.beCourse === "1"?
                                    <svg onClick={()=>changeCourse(item)} xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
                                    <path id="联合_317" data-name="联合 317" d="M11171.048,5195.141a5.248,5.248,0,0,1,.7-7.057l1.706-1.473.773,1.02-1.706,1.473a3.877,3.877,0,0,0-.514,5.212,3.329,3.329,0,0,0,4.887.548l1.616-1.4.774,1.02-1.616,1.4a4.506,4.506,0,0,1-2.958,1.118A4.59,4.59,0,0,1,11171.048,5195.141Zm8.773-2.809,1.66-1.433a3.876,3.876,0,0,0,.514-5.212,3.329,3.329,0,0,0-4.887-.548l-1.55,1.338-.773-1.02,1.549-1.338a4.508,4.508,0,0,1,6.617.741,5.247,5.247,0,0,1-.7,7.058l-1.659,1.433Zm-5.755-.485,5.281-4.695.788,1.007-5.282,4.695Z" transform="translate(-11170 -5183)" fill="#09f"/>
                                    </svg>:
                                    item.beExternal === "0"?
                                    <>
                                        <svg onClick={()=>editSchedule(item)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                        <path id="联合_176" data-name="联合 176" d="M-15086.5,939h-13a.5.5,0,0,1-.5-.5v-13a.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-6.5v12h12v-6.5a.5.5,0,0,1,.5-.5.5.5,0,0,1,.5.5v7a.5.5,0,0,1-.5.5Zm-7.3-6.2a.494.494,0,0,1,0-.7l6.362-6.367a.506.506,0,0,1,.709,0,.505.505,0,0,1,0,.709l-6.366,6.363a.492.492,0,0,1-.353.148A.492.492,0,0,1-15093.8,932.8Z" transform="translate(15100.002 -925)" fill="#09f"/>
                                        </svg>
                                        <svg onClick={()=>deleteSchedule(item)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                        <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                                        </svg>
                                    </>:
                                    <svg onClick={()=>deleteSchedule(item)} xmlns="http://www.w3.org/2000/svg" width="14.003" height="13.999" viewBox="0 0 14.003 13.999">
                                    <path id="联合_315" data-name="联合 315" d="M-15088.5,939h-9a.5.5,0,0,1-.5-.5V928h-1.5a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h13a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5h-1.5v10.5a.5.5,0,0,1-.5.5Zm-.5-1V928h-2v10Zm-3,0V928h-2v10Zm-3,0V928h-2v10Zm-1.5-12a.5.5,0,0,1-.5-.5.5.5,0,0,1,.5-.5h7a.5.5,0,0,1,.5.5.5.5,0,0,1-.5.5Z" transform="translate(15100.002 -925)" fill="#ef5757"/>
                                    </svg>
                                }
                                {/* <svg onClick={()=>closeTooltip(index)} xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12">
                                <path id="联合_316" data-name="联合 316" d="M11176,5189.75l-5.251,5.252-.749-.75,5.25-5.251-5.25-5.252.752-.747,5.248,5.249,5.248-5.249.752.747-5.25,5.252,5.25,5.251-.749.75Z" transform="translate(-11170 -5183.001)" fill="#999"/>
                                </svg> */}
                            </div>
                            <p className="detail_title" title={item.scheduleTitle||item.scheduleContent}>{item.scheduleTitle||item.scheduleContent}</p>
                            <p className="detail_one">
                                <span className="one_name">时间:</span>
                                <span className="one_value">{item.scheduleDate + " "+ item.startTime}-{(item.scheduleEndDate||item.scheduleDate) + " "+ item.endTime}</span>
                            </p>
                            {
                                item.beCourse === "1"?
                                <p className="detail_one">
                                    <span className="one_name">班级:</span>
                                    <span className="one_value" title={item.courseClassName}>{item.courseClassName||"--"}</span>
                                </p>:
                                ""
                            }
                            {
                                item.scheduleLocation?
                                <p className="detail_one">
                                    <span className="one_name">地点:</span>
                                    <span className="one_value" title={item.scheduleLocation}>{item.scheduleLocation||"--"}</span>
                                </p>:
                                ""
                            }
                            {
                                item.scheduleTitle && item.scheduleTitle.indexOf("会议")>-1?
                                <p className="detail_one">
                                    <span className="one_name">发起人:</span>
                                    <span className="one_value" title={`${item.userName}(${item.userId})`}>
                                        {item.userName}
                                        <span style={{color: "#999"}}>({item.userId})</span>
                                    </span>
                                </p>:
                                ""
                            }
                            {
                                item.beCourse === "1"?
                                "":
                                scheduleInfo.joinUserInfo && scheduleInfo.joinUserInfo["all"]>0?
                                <p className="detail_one">
                                    <span className="one_name">参与人:</span>
                                    <span className="one_value" data-sign="schedule">
                                        {
                                            scheduleInfo.taskMemberVoList?.length?
                                            <>
                                            共<span style={{fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["all"]}</span>人,&nbsp;
                                            <span style={{color: "#009900", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["access"]}</span>人接受,&nbsp;
                                            <span style={{color: "#ff0000", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["reject"]}</span>人已拒绝,&nbsp;
                                            <span style={{color: "#333333", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["noResponse"]}</span>人未响应&nbsp;
                                            </>:
                                            <>
                                            <span style={{color: "#009900", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["access"]}</span>人已接受,&nbsp;
                                            <span style={{color: "#ff0000", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["reject"]}</span>人已拒绝,&nbsp;
                                            <span style={{color: "#ff6600", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["read"]}</span>人待定,&nbsp;
                                            <span style={{color: "#333333", fontWeight: "bold"}}>{scheduleInfo.joinUserInfo["noResponse"]}</span>人未读&nbsp;
                                            </>
                                        }
                                        <Popover
                                        overlayClassName="task_user_detail schedule"
                                        trigger={"click"}
                                        placement="right"
                                        content={
                                            <LgTabs 
                                            data={detailTabData}
                                            // titleItemStyle={{marginRight:20}}
                                            className="one_tabs"></LgTabs>
                                        }>
                                            <svg data-sign="schedule" className="detaillogo" id="详情" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
                                            <rect id="矩形_3325" data-name="矩形 3325" width="1" height="14" fill="#09f"/>
                                            <rect id="矩形_3326" data-name="矩形 3326" width="2" height="1" transform="translate(3 6)" fill="#09f"/>
                                            <rect id="矩形_3328" data-name="矩形 3328" width="10" height="1" transform="translate(0 13)" fill="#09f"/>
                                            <rect id="矩形_3329" data-name="矩形 3329" width="1" height="4" transform="translate(13)" fill="#09f"/>
                                            <rect id="矩形_3330" data-name="矩形 3330" width="14" height="1" fill="#09f"/>
                                            <rect id="矩形_3331" data-name="矩形 3331" width="8" height="1" transform="translate(3 3)" fill="#09f"/>
                                            <path id="联合_184" data-name="联合 184" d="M-1504.2-3216.486a3.568,3.568,0,0,1-2.193.752,3.624,3.624,0,0,1-3.6-3.633,3.623,3.623,0,0,1,3.6-3.632,3.623,3.623,0,0,1,3.6,3.632,3.634,3.634,0,0,1-.692,2.139l1.483,1.494-.728.734Zm-4.768-2.882a2.588,2.588,0,0,0,2.575,2.6,2.551,2.551,0,0,0,1.69-.639l.251-.253a2.6,2.6,0,0,0,.634-1.7,2.588,2.588,0,0,0-2.575-2.594A2.588,2.588,0,0,0-1508.97-3219.368Z" transform="translate(1516 3228)" fill="#09f"/>
                                            <rect id="矩形_3332" data-name="矩形 3332" width="2" height="1" transform="translate(3 9)" fill="#09f"/>
                                            </svg>

                                        </Popover>
                                    </span>
                                </p>:
                                ""
                            }
                            {
                                item.scheduleTitle && item.scheduleTitle.indexOf("会议")>-1?
                                <p className="detail_one">
                                    <span className="one_name">会议签到:</span>
                                    <span className="one_value" title={item.scheduleContent}>
                                    {
                                        item.beSignIn === "1"?
                                        item.userId === userInfo.userId?
                                        <>
                                            <span style={{color: "#009900", fontWeight: "bold"}}>{item.meetSignInfo?item.meetSignInfo["meetSign1"]:0}</span>人已签到,&nbsp;
                                            <span style={{color: "#ff6600", fontWeight: "bold"}}>{item.meetSignInfo?item.meetSignInfo["meetSign0"]:0}</span>人未签到&nbsp;
                                            <svg onClick={()=>showMeeInfoModal(item)} className="detaillogo" id="详情" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
                                            <rect id="矩形_3325" data-name="矩形 3325" width="1" height="14" fill="#09f"/>
                                            <rect id="矩形_3326" data-name="矩形 3326" width="2" height="1" transform="translate(3 6)" fill="#09f"/>
                                            <rect id="矩形_3328" data-name="矩形 3328" width="10" height="1" transform="translate(0 13)" fill="#09f"/>
                                            <rect id="矩形_3329" data-name="矩形 3329" width="1" height="4" transform="translate(13)" fill="#09f"/>
                                            <rect id="矩形_3330" data-name="矩形 3330" width="14" height="1" fill="#09f"/>
                                            <rect id="矩形_3331" data-name="矩形 3331" width="8" height="1" transform="translate(3 3)" fill="#09f"/>
                                            <path id="联合_184" data-name="联合 184" d="M-1504.2-3216.486a3.568,3.568,0,0,1-2.193.752,3.624,3.624,0,0,1-3.6-3.633,3.623,3.623,0,0,1,3.6-3.632,3.623,3.623,0,0,1,3.6,3.632,3.634,3.634,0,0,1-.692,2.139l1.483,1.494-.728.734Zm-4.768-2.882a2.588,2.588,0,0,0,2.575,2.6,2.551,2.551,0,0,0,1.69-.639l.251-.253a2.6,2.6,0,0,0,.634-1.7,2.588,2.588,0,0,0-2.575-2.594A2.588,2.588,0,0,0-1508.97-3219.368Z" transform="translate(1516 3228)" fill="#09f"/>
                                            <rect id="矩形_3332" data-name="矩形 3332" width="2" height="1" transform="translate(3 9)" fill="#09f"/>
                                            </svg>
                                        </>:
                                        <span className="meet-sign-info">需要签到<span className={`meet-sign-${item.beMySignIn}`}>{item.beMySignIn==="1"?"已签到":"尚未签到"}</span></span>:
                                        "无需签到"
                                    }
                                    </span>
                                </p>:
                                ""
                            }
                            {
                                item.beCourse === "1"||!item.scheduleContent?
                                "":
                                <p className="detail_one">
                                    <span className="one_name">日程描述:</span>
                                    <span className="one_value" title={item.scheduleContent}>
                                    {
                                        item.scheduleContent?
                                        item.scheduleContent.length > 45? 
                                        item.scheduleContent.substr(0, 45) + "...": 
                                        item.scheduleContent:
                                        "--"
                                    }
                                    </span>
                                </p>
                            }
                            {
                                 moment(item.scheduleDate + " "+ item.startTime) > moment() &&
                                 moment(item.scheduleDate + " "+ item.startTime).subtract(item.remindTime, "m").diff(moment(), "h") < 24?
                                 <p className="detail_tip">
                                    该日程将会在
                                    {
                                    
                                        item.remindRealTime?
                                        getTimeDiff(moment(item.remindRealTime).format("YYYY-MM-DD HH:mm"), "day"):
                                        getTimeDiff(moment(item.scheduleDate + " "+ item.startTime).subtract(item.remindTime, "m").format("YYYY-MM-DD HH:mm"), "day")
                                    }
                                    后提醒您
                                </p>:
                                ""

                            }
                            
                        </div>
                    )}>
                    <div className="schedule_one" key={index} data-sign="schedule">
                        <span data-sign="schedule" className={`schedule_time ${item.beAllDay === "1"? "padding": ""}`} title={`时间: ${item.startTime}-${item.endTime}`}>
                            {
                                item.beAllDay === "1"?
                                "":
                                <span className={`${
                                    getDateType(item.scheduleDate + " " + item.startTime) === "凌晨" ||
                                    getDateType(item.scheduleDate + " " + item.startTime) === "上午"?
                                    "time_type_morning":
                                    "time_type_afternoon"
                                }`} >
                                    {getDateType(item.scheduleDate + " " + item.startTime)}
                                </span>
                            }
                            {item.beAllDay === "1"? "全天": item.startTime}
                            {/* {item.startTime}~{item.endTime} */}
                        </span>
                        <span className="schedule_content" title={item.scheduleTitle||item.scheduleContent}>
                            {
                                item.scheduleMark?
                                <span className="type_container" data-sign="schedule">
                                    <span className="schedule_type" title={item.scheduleMark}>{item.scheduleMark}</span>
                                </span>:
                                ""
                                // <span className="type_empty"></span>
                            }
                            {item.scheduleTitle||item.scheduleContent}
                        </span>
                        {
                            item.scheduleLocation && item.scheduleContent?
                            <>
                                <span className="schedule_location" data-sign="schedule" title={item.scheduleLocation}>
                                    {item.className? <span>{item.className}&nbsp;&nbsp;</span>: ""}
                                    {item.scheduleLocation? item.scheduleLocation: ""}
                                </span>
                                <span className="schedule_remark" title={item.beCourse === "1"? "": item.scheduleContent}>
                                    {item.beCourse === "1"? "": item.scheduleContent? item.scheduleContent: ""}
                                </span>
                            </>:
                            <span className="schedule_remark" style={{width: "35%"}} data-sign="schedule" title={`${item.className||""}  ${item.scheduleLocation||item.scheduleContent}`}>
                                {item.className? <span>{item.className}&nbsp;&nbsp;</span>: ""}
                                {item.scheduleLocation? item.scheduleLocation: ""}
                                {item.scheduleContent? item.scheduleContent: ""}
                            </span>
                        }
                        <span className="schedule_btn">
                            {
                                // item.beCourse === "1"||item.beExternal === "1"?
                                Array.isArray(item.functionLinkInfoList) && item.functionLinkInfoList.length > 0?  //外部系统对接的日程
                                item.functionLinkInfoList.length < 3?
                                item.functionLinkInfoList.map((child, index2)=>(
                                    <>
                                        {!index2?"":<span className="slice_line"></span>}
                                        <span 
                                        key={index2}
                                        className={child.functionName === "删除"? "delete_btn": "edit_btn"}
                                        title={child.functionName} 
                                        onClick={(e)=>goExternal(child, item,  e)}>{child.functionName}</span>
                                        
                                    </>
                                )):
                                <>
                                    <span
                                    className="edit_btn" 
                                    style={{color: item.functionLinkInfoList[0]?.pcLink === "delete"? "#ef5757": ""}}
                                    title={item.functionLinkInfoList[0].functionName} 
                                    onClick={(e)=>goExternal(item.functionLinkInfoList[0], item,  e)}>{item.functionLinkInfoList[0].functionName}</span>
                                    <span className="slice_line"></span>
                                    <Dropdown
                                    overlayClassName="btn_drop"
                                    overlay={<Menu 
                                        items={
                                            item.functionLinkInfoList.slice(1,).map((child, index2)=>(
                                                {
                                                    key: index2+1,
                                                    label: (
                                                        <div 
                                                        className={`btn_drop_one ${child.pcLink === "delete"? "red": ""}`}
                                                        // style={{color: child.pcLink === "delete"? "#ef5757": ""}}
                                                        onClick={(e)=>goExternal(child, item,  e)}
                                                        key={index2}>{child.functionName}</div>
                                                    )
                                                }
                                            ))}
                                         />
                                    }>
                                    <span className="edit_btn more" onClick={(e)=>e.stopPropagation()}>更多</span>
                                    </Dropdown>
                                </>:
                                // "":
                                ""
                            }
                            {
                                item.beExternal === "1"?
                                "":
                                item.beCourse === "1"?
                                <>
                                {
                                    moment(item.scheduleDate+" "+item.startTime) > moment() &&
                                    identityList.filter(item=>item.identityCode === "IC0011").length > 0?
                                    <>
                                    {
                                        Array.isArray(item.functionLinkInfoList) && item.functionLinkInfoList.length > 0?
                                        <span className="slice_line"></span>:
                                        ""
                                    }
                                    <span className="edit_btn" onClick={(e)=>goCourse(item, e)}>备课</span>
                                    </>:
                                    ""
                                }
                                {
                                    moment(item.scheduleDate+" "+item.endTime) < moment(constructionDate(""))?
                                    "":
                                    <>
                                    {
                                        (Array.isArray(item.functionLinkInfoList) && item.functionLinkInfoList.length > 0) ||
                                        (moment(item.scheduleDate+" "+item.startTime) > moment() &&
                                        identityList.filter(item=>item.identityCode === "IC0011").length > 0)?
                                        <span className="slice_line"></span>:
                                        ""
                                    }
                                    <span className="edit_btn" onClick={(e)=>changeCourse(item, e)}>换课</span>
                                    </>
                                }
                                
                                </>:
                               moment(item.scheduleDate+" "+item.endTime) < moment(constructionDate(""))?
                               <>
                                    {
                                        Array.isArray(item.functionLinkInfoList) && item.functionLinkInfoList.length > 0?
                                        <span className="slice_line"></span>:
                                        ""
                                    }
                                    <span className="delete_btn" onClick={(e)=>deleteSchedule(item, e)}>删除</span>
                               </>
                               :
                                <>
                                    {
                                        Array.isArray(item.functionLinkInfoList) && item.functionLinkInfoList.length > 0?
                                        <span className="slice_line"></span>:
                                        ""
                                    }
                                    <span className="edit_btn" onClick={(e)=>editSchedule(item, e)}>编辑</span>
                                    <span className="slice_line"></span>
                                    <span className="delete_btn" onClick={(e)=>deleteSchedule(item, e)}>删除</span>
                                </>
                            }
                        </span>
                        {
                            moment(item.scheduleDate+" "+item.endTime) > moment(constructionDate("")) ||
                            (item.scheduleDate === moment().format("YYYY-MM-DD") && index === scheduleList.length - 1)?
                            <div className="schedule_line hover">
                                <div className="add_btn" onClick={(e)=>modalChange(true, item, e)}></div>
                            </div>:
                            <div className="schedule_line">
                            </div>
                        }
                    </div>
                    </Popover>
                    </>
                    )
                }):
                <Empty 
                className="contentlogo" 
                style={{marginTop: userInfo.userType === "0" || userInfo.userType === "11" || (userInfo.userType === "1" && !classList.length)? 100: ""}}
                text={moment(currentDay) >= moment().startOf('day')?<span>你还没有添加日程，请点击<span className="blue_btn" onClick={()=>modalChange(true, {
                    scheduleDate: currentDay,
                    scheduleEndDate: currentDay,
                    startTime: moment().format("HH:mm")
                })}>添加日程</span></span>: "暂无日程安排~"} />
            }
        </div>
        </Scrollbars>
        <MyModal 
        className="meet-sign-modal"
        width={900}
        height={562}
        noFooter={true}
        visible={meetModalVisible} 
        changeVisible={(value)=>setMeetModalVisible(value)}
        title="会议签到情况">
            <div className="meet-modal-container">
                <div className="meet-modal-info">
                    <div className="meet-modal-time">
                        时间:
                        <span>{meetModalInfo.scheduleDate}  {meetModalInfo.startTime}~{meetModalInfo.endTime}</span>
                    </div>
                    <div className="meet-modal-time">
                        地点:
                        <span>{meetModalInfo.scheduleLocation||"--"}</span>
                    </div>
                    <div className="meet-modal-time">
                        发起人:
                        <span>{meetModalInfo.userName}<span>({meetModalInfo.userId})</span></span>
                    </div>
                </div>
                <div className="meet-join-info">
                    <div className="meet-join-num">
                        <span style={{color: "#009900"}}>{meetModalInfo.meetSignInfo?.meetSign1||0}</span>
                        人已签到，
                        <span style={{color: "#ff6600"}}>{meetModalInfo.meetSignInfo?.meetSign0||0}</span>
                        人未签到
                    </div>
                    <div className="meet-join-option">
                        <Search placeholder="搜索姓名..." searchMethod={searchMeetUser} />
                        <div className="output-btn" onClick={()=>ouputMeetJoinInfo(meetModalInfo)}>导出</div>
                    </div>
                </div>
                <Scrollbars style={{height: 429}}>
                <TableList
                tableHeader={columns}
                emptyText={keyword? "搜素结果为空": ""}
                data={meetUserList}
                ></TableList>
                </Scrollbars>
            </div>
        </MyModal>

        <QRCodeDialog
        scheduleInfo={qrcodeInfo}
        visible={qrcodeVisible} 
        changeVisible={qrcodeModalChange} />

        </div>
    )
}
const mapProps = (state) => {
    return {
        userInfo: state.userInfo,
        sysAddrInfo: state.sysAddrInfo,
        identityList: state.identityList,
        currentIdentity: state.currentIdentity,
        skinInfo: state.skinInfo,
        sysInfo: state.sysInfo,
        termInfo: state.termInfo
    }
}
export default connect(mapProps)(MyScheduleWeek);